package com.niit.controller;

import com.niit.entity.Student;
import com.niit.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("/student")
public class StudentController {

    @Autowired
    StudentService service;

    @RequestMapping("/byConditions")
    public String getStudentsByConditions(Student student, Model model){
        List<Student> students = service.queryByConditions(student);
        model.addAttribute("students",students);
        return "studentInfo";
    }
}
